<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>智能控制中心</title>
  <!-- 引入外部资源 -->
  <script src="{{ url_for('static', filename='js/tailwindcss.js') }}"></script>
  <link rel="stylesheet" href="{{ url_for('static', filename='css/font-awesome.min.css') }}">
  
  <!-- 配置Tailwind -->
  <script>
    tailwind.config = {
      theme: {
        extend: {
          colors: {
            primary: '#165DFF',
            secondary: '#0F172A',
            accent: '#36CFC9',
            neutral: '#F1F5F9',
            success: '#52C41A',
            warning: '#FAAD14',
            danger: '#FF4D4F',
            elevator: {
              main: '#2563eb',
              door: '#94a3b8',
              shaft: '#1e293b',
              button: '#64748b',
              buttonActive: '#f97316'
            }
          },
          fontFamily: {
            inter: ['Inter', 'system-ui', 'sans-serif'],
          },
          
        },
      }
    }
  </script>
  
  <!-- 引入拆分的CSS文件 -->
  <style type="text/tailwindcss">
    @layer utilities {
      .content-auto {
        content-visibility: auto;
      }
      .sidebar-item-active {
        @apply bg-primary/10 text-primary border-l-4 border-primary;
      }
      .card-hover {
        @apply transition-all duration-300 hover:shadow-lg hover:-translate-y-1;
      }
      .animate-pulse-slow {
        animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
      }
      /* 电梯相关工具类 */
      .elevator-door {
        @apply bg-elevator-door transition-all duration-700 ease-in-out;
      }
      .elevator-button {
        @apply w-10 h-10 rounded-full bg-elevator-button text-white flex items-center justify-center cursor-pointer transition-all duration-300 hover:bg-elevator-buttonActive;
      }
      .elevator-button.active {
        @apply bg-elevator-buttonActive scale-110;
      }
      .floor-indicator {
        @apply absolute top-4 left-1/2 -translate-x-1/2 text-white text-xl font-bold;
      }
      /* OTA检查动画相关样式 */
      .ota-step {
        @apply flex items-center justify-between p-4 border-b border-gray-100 last:border-0 transition-all duration-500;
      }
      .step-active {
        @apply bg-blue-50 border-l-4 border-primary pl-3 -ml-4;
      }
      .step-completed {
        @apply bg-green-50;
      }
      .step-failed {
        @apply bg-red-50;
      }
      .step-icon {
        @apply w-10 h-10 rounded-full flex items-center justify-center transition-all duration-500;
      }
      .progress-bar {
        @apply h-2 bg-gray-200 rounded-full overflow-hidden transition-all duration-500;
      }
      .progress-fill {
        @apply h-full bg-primary transition-all duration-1000 w-0;
      }
      .pulse-ring {
        @apply absolute w-full h-full rounded-full border-2 border-primary/30 animate-ping;
      }
      .pulse-dot {
        @apply absolute w-3 h-3 bg-primary rounded-full;
      }
      .update-badge {
        @apply absolute -top-1 -right-1 bg-danger text-white text-xs rounded-full w-5 h-5 flex items-center justify-center animate-pulse;
      }
      /* 机器人相关 */
      .content-auto {
        content-visibility: auto;
      }
      .sidebar-item-active {
        @apply bg-primary/10 text-primary border-l-4 border-primary;
      }
      .card-hover {
        @apply transition-all duration-300 hover:shadow-lg hover:-translate-y-1;
      }
      .robot-status-indicator {
        @apply w-3 h-3 rounded-full inline-block mr-2;
      }
      .fade-in {
        animation: fadeIn 0.5s ease-in-out;
      }
      .fade-out {
        animation: fadeOut 0.3s ease-in-out;
      }
      .scale-in {
        animation: scaleIn 0.3s ease-in-out;
      }
      @keyframes fadeIn {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
      }
      @keyframes fadeOut {
        from { opacity: 1; transform: translateY(0); }
        to { opacity: 0; transform: translateY(10px); }
      }
      @keyframes scaleIn {
        from { opacity: 0; transform: scale(0.95); }
        to { opacity: 1; transform: scale(1); }
      }
    }
  </style>
  <link rel="stylesheet" href="{{ url_for('static', filename='css/elevator.css') }}">
  <link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>

<body class="font-inter bg-gray-50 text-gray-800 min-h-screen flex overflow-hidden">
  <!-- 左侧导航栏 -->
  <aside class="bg-white w-64 shadow-md z-10 hidden md:block transition-all duration-300 ease-in-out">
    <!-- 品牌标识 -->
    <div class="p-5 border-b border-gray-200">
      <div class="flex items-center space-x-3">
        <div class="w-10 h-10 rounded-lg bg-primary flex items-center justify-center">
          <i class="fa fa-cogs text-white text-xl"></i>
        </div>
        <h1 class="text-xl font-bold text-secondary">智能控制中心</h1>
      </div>
    </div>
    
    <!-- 导航菜单 -->
    <nav class="py-6 px-3">
      <p class="text-xs uppercase text-gray-500 font-semibold px-4 mb-3">控制功能</p>
      
      <a href="/elevator" class="flex items-center px-4 py-3 mb-1 rounded-md cursor-pointer {% if active_tab == 'elevator' %}sidebar-item-active{% else %}text-gray-600 hover:bg-gray-100 transition-colors{% endif %}">
        <i class="fa fa-building-o w-6 text-center"></i>
        <span class="ml-3">电梯控制</span>
      </a>
            
      <a href="/robot" class="flex items-center px-4 py-3 mb-1 rounded-md cursor-pointer {% if active_tab == 'robot' %}sidebar-item-active{% else %}text-gray-600 hover:bg-gray-100 transition-colors{% endif %}">
        <i class="fa fa-android w-6 text-center"></i>
        <span class="ml-3">机器人状态</span>
      </a>
      
      <!-- <div class="mt-8 pt-6 border-t border-gray-200">
        <p class="text-xs uppercase text-gray-500 font-semibold px-4 mb-3">系统</p>
        


      </div> -->
    </nav>
  </aside>
  
  <!-- 主内容区域 -->
  <main class="flex-1 flex flex-col overflow-hidden">
    <!-- 顶部状态栏 -->
    <header class="bg-white shadow-sm px-6 py-4 flex justify-between items-center">
      <button class="md:hidden text-gray-500 focus:outline-none" id="menu-toggle">
        <i class="fa fa-bars text-xl"></i>
      </button>
      
      <div class="flex items-center space-x-6">
        <div class="relative">
          <input type="text" placeholder="搜索..." class="pl-10 pr-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary w-64 transition-all">
          <i class="fa fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
        </div>
        
        <div class="flex items-center space-x-4">
          <button class="relative p-2 text-gray-500 hover:text-primary transition-colors">
            <i class="fa fa-bell text-xl"></i>
            <span class="absolute top-1 right-1 w-2 h-2 bg-danger rounded-full"></span>
          </button>
          
          <div class="flex items-center space-x-2">
            <img src="/static/images/usr.png" alt="用户头像" class="w-8 h-8 rounded-full object-cover">
            <span class="hidden md:inline font-medium">管理员</span>
          </div>
        </div>
      </div>
    </header>
    
    <!-- 内容滚动区域 -->
    <div class="flex-1 overflow-y-auto p-6 bg-gray-50">
      <!-- 电梯控制模块 -->
      <section id="elevator" class="{% if active_tab == 'elevator' %}block{% else %}hidden{% endif %} mb-10">
        <div class="flex justify-between items-center mb-6">
          <h2 class="text-2xl font-bold text-secondary">电梯控制</h2>
          <div class="text-sm text-gray-500">
            <span id="current-time">2025-11-18 10:30:00</span>
          </div>
        </div>
        
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
          <!-- 电梯动画展示 -->
          <div class="bg-white rounded-xl shadow-sm p-6 card-hover lg:col-span-1">
            <div class="flex justify-between items-start mb-4">
              <div>
                <h3 class="font-semibold text-lg">电梯动画监控</h3>
                <p class="text-sm text-gray-500">实时显示电梯状态</p>
              </div>
              <span class="px-3 py-1 bg-success/10 text-success text-xs rounded-full" id="elevatorStatusText">运行中</span>
            </div>
            
            <!-- 电梯井道和轿厢 -->
            <div class="elevator-shaft mx-auto">
              <!-- 楼层标记 -->
              <div class="floor-marker" style="top: 0;"></div>    <!-- 3楼 -->
              <div class="floor-marker" style="top: 180px;"></div> <!-- 2楼 -->
              <div class="floor-marker" style="top: 360px;"></div> <!-- 1楼 -->
              
              <!-- 楼层指示器 -->
              <div class="floor-indicator">3F</div>
              <div class="floor-indicator" style="top: 180px;">2F</div>
              <div class="floor-indicator" style="top: 360px;">1F</div>
              
              <!-- 电梯轿厢 -->
              <div id="elevatorCab" class="elevator-cab">
                <div id="elevatorDoors" class="elevator-doors">
                  <div class="door-left elevator-door"></div>
                  <div class="door-right elevator-door"></div>
                </div>
                <!-- 轿厢内按钮 -->
                <!-- <div class="absolute bottom-4 left-1/2 -translate-x-1/2 flex flex-col gap-2">
                  <div class="elevator-button floor-btn" data-floor="3">3</div>
                  <div class="elevator-button floor-btn" data-floor="2">2</div>
                  <div class="elevator-button floor-btn" data-floor="1">1</div>
                </div> -->
                <!-- 当前楼层显示 -->
                <div class="absolute top-3 left-3 bg-white text-elevator-shaft px-2 py-1 rounded text-sm font-bold" id="currentFloorDisplay">1F</div>
              </div>

            </div>
            <div class="bg-white rounded-xl shadow-sm p-6">
            <!-- 电梯状态信息 -->
              <div class="mt-6 space-y-3">
                <div>
                  <span class="text-gray-600">当前楼层:</span>
                  <span id="statusFloor" class="font-semibold ml-2">1F</span>
                </div>
                <div>
                  <span class="text-gray-600">运行状态:</span>
                  <span id="statusRunning" class="font-semibold ml-2">静止</span>
                </div>
                <div>
                  <span class="text-gray-600">门状态:</span>
                  <span id="statusDoors" class="font-semibold ml-2">关闭</span>
                </div>
              </div>
              
              <!-- 门控制按钮 -->
              <div class="mt-4 flex gap-3">
                <button id="openDoorBtn" class="flex-1 px-4 py-2 bg-success text-white rounded-lg text-sm hover:bg-success/90 transition-colors">
                  <i class="fa fa-door-open mr-1"></i> 开门
                </button>
                <button id="closeDoorBtn" class="flex-1 px-4 py-2 bg-danger text-white rounded-lg text-sm hover:bg-danger/90 transition-colors">
                  <i class="fa fa-door-closed mr-1"></i> 关门
                </button>
              </div>
            </div>
          </div>
          
          <!-- 电梯列表 -->
          <div class="lg:col-span-2 space-y-6">
                        <!-- 电梯控制面板 -->
            <div class="bg-white rounded-xl shadow-sm p-6">
              <h3 class="font-semibold text-lg mb-4">电梯调度</h3>
              <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                <div>
                  <label class="block text-sm font-medium text-gray-700 mb-2">选择电梯</label>
                  <select id="elevatorSelect" class="w-full p-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary">
                    <option value="1">电梯 #1</option>
                  </select>
                </div>
                
                <div>
                  <label class="block text-sm font-medium text-gray-700 mb-2">目标楼层</label>
                  <select id="targetFloorSelect" class="w-full p-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary">
                    <option value="1">1楼</option>
                    <option value="2">2楼</option>
                    <option value="3">3楼</option>
                  </select>
                </div>
                
                <div class="flex items-end">
                  <button id="sendCommandBtn" class="w-full px-6 py-2 bg-primary text-white rounded-lg hover:bg-primary/90 transition-colors">
                    发送指令
                  </button>
                </div>
              </div>
              
              <!-- 楼层按钮快捷操作 -->
              <div class="mt-6">
                <h4 class="font-medium text-gray-700 mb-3">快捷楼层选择</h4>
                <div class="flex flex-wrap gap-2">
                  <button class="quick-floor-btn elevator-button" data-floor="1">1</button>
                  <button class="quick-floor-btn elevator-button" data-floor="2">2</button>
                  <button class="quick-floor-btn elevator-button" data-floor="3">3</button>
                </div>
              </div>

            </div>
            <div class="bg-white rounded-xl shadow-sm p-6">
            <!-- 电梯状态信息 -->
              <div class="mt-6 space-y-3">
                <div>
                  <h3 class="font-semibold text-lg">主入口闸机</h3>
                  <p class="text-sm text-gray-500">前门大厅</p>
                  <span class="px-3 py-1 bg-success/10 text-success text-xs rounded-full">正常</span>
                </div>
              </div>
              
              <!-- 闸机控制按钮 -->
              <div class="mt-4 flex gap-3">
                <button id="openGateBtn" class="flex-1 px-4 py-2 bg-success text-white rounded-lg text-sm hover:bg-success/90 transition-colors">
                  <i class="fa fa-door-open mr-1"></i> 开门
                </button>
                <button id="closeGateBtn" class="flex-1 px-4 py-2 bg-danger text-white rounded-lg text-sm hover:bg-danger/90 transition-colors">
                  <i class="fa fa-door-closed mr-1"></i> 关门
                </button>
              </div>
            </div>
          </div>
        </div>
      </section>
      
      <!-- 机器人状态页面 -->
      <section id="robot" class="{% if active_tab == 'robot' %}block{% else %}hidden{% endif %} mb-10">
        <div class="flex justify-between items-center mb-6">
          <h2 class="text-2xl font-bold text-secondary">机器人状态</h2>
          <div class="text-sm text-gray-500">
            <span id="current-time-robot">2025-11-18 10:30:00</span>
          </div>
        </div>
        
        <!-- 操作按钮区 -->
        <div class="mb-6 flex justify-between items-center">
          <div>
            <p class="text-gray-600"><span id="onlineCount" class="font-medium text-robot-online">0</span> 台在线，<span id="totalCount" class="font-medium">0</span> 台总数</p>
          </div>
          <button id="addRobotBtn" class="px-4 py-2 bg-primary text-white rounded-lg text-sm hover:bg-primary/90 transition-colors flex items-center">
            <i class="fa fa-plus mr-2"></i> 添加机器人设备
          </button>
        </div>
        
        <!-- 机器人列表 -->
        <div id="robotsContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
          <!-- 机器人将通过JSON数据动态加载 -->
        </div>
      </section>

      <!-- 设置页面 - OTA升级检查 -->
      <section id="settings" class="{% if active_tab == 'settings' %}block{% else %}hidden{% endif %} mb-10">
        <div class="flex justify-between items-center mb-6">
          <h2 class="text-2xl font-bold text-secondary">系统设置</h2>
          <div class="text-sm text-gray-500">
            <span id="current-time-settings">{{ current_time() }}</span>
          </div>
        </div>
        
        <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
          <!-- OTA升级检查面板 -->
          <div class="lg:col-span-2 bg-white rounded-xl shadow-sm p-6 card-hover">
            <div class="flex justify-between items-start mb-6">
              <div>
                <h3 class="font-semibold text-lg">系统OTA升级</h3>
                <p class="text-sm text-gray-500">检查并升级到最新系统版本</p>
              </div>
              <div class="flex space-x-2">
                <button id="checkUpdateBtn" class="px-4 py-2 bg-primary text-white rounded-lg text-sm hover:bg-primary/90 transition-colors">
                  <i class="fa fa-refresh mr-1"></i> 检查更新
                </button>
                <button id="startUpdateBtn" class="px-4 py-2 bg-success text-white rounded-lg text-sm hover:bg-success/90 transition-colors hidden">
                  <i class="fa fa-download mr-1"></i> 开始升级
                </button>
              </div>
            </div>
            
            <!-- 当前版本信息 -->
            <div class="mb-6 p-4 bg-gray-50 rounded-lg">
              <div class="flex justify-between items-center">
                <div>
                  <span class="text-sm text-gray-500">当前版本</span>
                  <p class="font-medium mt-1">v2.3.5</p>
                </div>
                <div id="latestVersion" class="text-right">
                  <span class="text-sm text-gray-500">最新版本</span>
                  <p class="font-medium mt-1">检查中...</p>
                </div>
              </div>
            </div>
            
            <!-- 升级进度指示器 -->
            <div class="mb-6">
              <div class="flex justify-between text-sm mb-2">
                <span>升级进度</span>
                <span id="updateProgressText">0%</span>
              </div>
              <div class="progress-bar">
                <div id="updateProgressBar" class="progress-fill"></div>
              </div>
            </div>
            
            <!-- OTA升级步骤 -->
            <div class="space-y-1" id="otaSteps">
              <div class="ota-step" data-step="checking">
                <div class="flex items-center">
                  <div class="step-icon mr-3 bg-gray-100">
                    <i class="fa fa-search text-gray-500"></i>
                  </div>
                  <span>检查更新包</span>
                </div>
                <div class="flex items-center">
                  <span class="text-sm text-gray-500 step-status">等待检查</span>
                </div>
              </div>
              <div class="ota-step" data-step="downloading">
                <div class="flex items-center">
                  <div class="step-icon mr-3 bg-gray-100">
                    <i class="fa fa-download text-gray-500"></i>
                  </div>
                  <span>下载更新包</span>
                </div>
                <div class="flex items-center">
                  <span class="text-sm text-gray-500 step-status">等待下载</span>
                </div>
              </div>
              
              <div class="ota-step" data-step="verifying">
                <div class="flex items-center">
                  <div class="step-icon mr-3 bg-gray-100">
                    <i class="fa fa-shield text-gray-500"></i>
                  </div>
                  <span>验证更新包</span>
                </div>
                <div class="flex items-center">
                  <span class="text-sm text-gray-500 step-status">等待验证</span>
                </div>
              </div>
              
              <div class="ota-step" data-step="installing">
                <div class="flex items-center">
                  <div class="step-icon mr-3 bg-gray-100">
                    <i class="fa fa-cogs text-gray-500"></i>
                  </div>
                  <span>安装更新</span>
                </div>
                <div class="flex items-center">
                  <span class="text-sm text-gray-500 step-status">等待安装</span>
                </div>
              </div>
              
              <div class="ota-step" data-step="rebooting">
                <div class="flex items-center">
                  <div class="step-icon mr-3 bg-gray-100">
                    <i class="fa fa-refresh text-gray-500"></i>
                  </div>
                  <span>系统重启</span>
                </div>
                <div class="flex items-center">
                  <span class="text-sm text-gray-500 step-status">等待重启</span>
                </div>
              </div>
            </div>
            
            <!-- 升级结果总结 -->
            <div id="updateResult" class="mt-6 p-4 rounded-lg hidden">
              <div class="flex items-center mb-2">
                <div id="resultIcon" class="w-8 h-8 rounded-full flex items-center justify-center mr-3"></div>
                <h4 id="resultTitle" class="font-medium"></h4>
              </div>
              <p id="resultDescription" class="text-sm text-gray-600"></p>
            </div>
          </div>
          
          <!-- 系统信息面板 -->
          <div class="bg-white rounded-xl shadow-sm p-6 card-hover">
            <h3 class="font-semibold text-lg mb-4">系统信息</h3>
            
            <div class="space-y-4">
              <div>
                <h4 class="text-sm text-gray-500 mb-1">当前版本</h4>
                <p class="font-medium">v2.3.5</p>
              </div>
              
              <div>
                <h4 class="text-sm text-gray-500 mb-1">上次更新时间</h4>
                <p class="font-medium">2025-10-28 09:15:33</p>
              </div>
              
              <div>
                <h4 class="text-sm text-gray-500 mb-1">更新通道</h4>
                <p class="font-medium">稳定版</p>
              </div>
              
              <div>
                <h4 class="text-sm text-gray-500 mb-1">更新包大小</h4>
                <p class="font-medium">~245 MB</p>
              </div>
              
              <div class="pt-4 border-t border-gray-100">
                <h4 class="text-sm text-gray-500 mb-2">升级注意事项</h4>
                <ul class="text-sm text-gray-600 space-y-2">
                  <li class="flex items-start">
                    <i class="fa fa-info-circle text-primary mt-1 mr-2"></i>
                    <span>升级过程中请勿关闭电源</span>
                  </li>
                  <li class="flex items-start">
                    <i class="fa fa-info-circle text-primary mt-1 mr-2"></i>
                    <span>系统将重启1-2次，耗时约5分钟</span>
                  </li>
                  <li class="flex items-start">
                    <i class="fa fa-info-circle text-primary mt-1 mr-2"></i>
                    <span>升级前请确保设备电量充足</span>
                  </li>
                </ul>
              </div>
            </div>
          </div>
        </div>
      </section>
    </div>
  </main>
  <!-- 配送任务模态框 -->
  <div id="deliveryModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center p-4">
    <div class="bg-white rounded-xl shadow-lg w-full max-w-2xl scale-in">
      <div class="p-5 border-b border-gray-100 flex justify-between items-center">
        <h3 class="text-lg font-semibold">创建配送任务</h3>
        <button id="closeDeliveryModal" class="text-gray-500 hover:text-gray-700 transition-colors">
          <i class="fa fa-times text-xl"></i>
        </button>
      </div>
      <div class="p-5">
        <form id="deliveryForm" class="space-y-6">
          <input type="hidden" id="robotId" name="robotId">
          
          <div>
            <label class="block text-sm font-medium text-gray-700 mb-2">机器人信息</label>
            <div class="bg-gray-50 p-3 rounded-lg">
              <p id="deliveryRobotName" class="font-medium"></p>
              <p id="deliveryRobotStatus" class="text-sm text-gray-500 mt-1"></p>
            </div>
          </div>
          
          <div>
            <label for="deliveryRoom" class="block text-sm font-medium text-gray-700 mb-1">目标房间</label>
            <select id="deliveryRoom" name="deliveryRoom" 
                  class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"
                  required>
              <option value="">请选择房间</option>
              <option value="201">201 室</option>
              <option value="202">202 室</option>
              <option value="301">301 室</option>
              <option value="302">302 室</option>
            </select>
          </div>
          
          <div>
            <label class="block text-sm font-medium text-gray-700 mb-2">物品选择</label>
            <div class="grid grid-cols-2 md:grid-cols-3 gap-3">
              <label class="flex items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors">
                <input type="checkbox" name="items" value="矿泉水" class="mr-2 text-primary">
                <span>矿泉水</span>
              </label>
              <label class="flex items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors">
                <input type="checkbox" name="items" value="零食" class="mr-2 text-primary">
                <span>零食</span>
              </label>
              <label class="flex items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors">
                <input type="checkbox" name="items" value="文件" class="mr-2 text-primary">
                <span>文件</span>
              </label>
              <label class="flex items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors">
                <input type="checkbox" name="items" value="包裹" class="mr-2 text-primary">
                <span>包裹</span>
              </label>
              <label class="flex items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors">
                <input type="checkbox" name="items" value="餐品" class="mr-2 text-primary">
                <span>餐品</span>
              </label>
              <label class="flex items-center p-3 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors">
                <input type="checkbox" name="items" value="其他" class="mr-2 text-primary">
                <span>其他</span>
              </label>
            </div>
          </div>
          
          <div>
            <label for="deliveryNotes" class="block text-sm font-medium text-gray-700 mb-1">备注信息</label>
            <textarea id="deliveryNotes" name="deliveryNotes" rows="3" placeholder="请输入特殊要求或说明..."
                    class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"></textarea>
          </div>
        </form>
      </div>
      <div class="p-5 border-t border-gray-100 flex justify-end space-x-3">
        <button id="cancelDeliveryBtn" class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg text-sm hover:bg-gray-50 transition-colors">
          取消
        </button>
        <button id="confirmDeliveryBtn" class="px-4 py-2 bg-primary text-white rounded-lg text-sm hover:bg-primary/90 transition-colors">
          提交任务
        </button>
      </div>
    </div>
  </div>
  
  <!-- 添加机器人模态框 -->
  <div id="addRobotModal" class="fixed inset-0 bg-black bg-opacity-50 z-50 hidden flex items-center justify-center p-4">
    <div class="bg-white rounded-xl shadow-lg w-full max-w-md scale-in">
      <div class="p-5 border-b border-gray-100 flex justify-between items-center">
        <h3 class="text-lg font-semibold">添加机器人设备</h3>
        <button id="closeAddModalBtn" class="text-gray-500 hover:text-gray-700 transition-colors">
          <i class="fa fa-times text-xl"></i>
        </button>
      </div>
      <div class="p-5">
        <form id="addRobotForm" class="space-y-4">
          <div>
            <label for="robotName" class="block text-sm font-medium text-gray-700 mb-1">机器人名称</label>
            <input type="text" id="robotName" name="robotName" placeholder="例如：配送机器人 R-005" 
                  class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"
                  required>
          </div>
          
          <div>
            <label for="robotType" class="block text-sm font-medium text-gray-700 mb-1">机器人类型</label>
            <select id="robotType" name="robotType" 
                  class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"
                  required>
              <option value="">请选择类型</option>
              <option value="delivery">配送机器人</option>
              <option value="cleaning">清洁机器人</option>
              <option value="security">安防机器人</option>
              <option value="service">服务机器人</option>
            </select>
          </div>
          
          <div>
            <label for="robotId" class="block text-sm font-medium text-gray-700 mb-1">设备ID</label>
            <div class="flex">
              <input type="text" id="robotId" name="robotId" placeholder="例如：RB2025005" 
                    class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"
                    required>
              <button type="button" id="generateIdBtn" class="ml-2 px-3 py-2 bg-gray-100 text-gray-700 rounded-lg text-sm hover:bg-gray-200 transition-colors">
                自动生成
              </button>
            </div>
          </div>
          
          <div>
            <label for="robotStatus" class="block text-sm font-medium text-gray-700 mb-1">初始状态</label>
            <select id="robotStatus" name="robotStatus" 
                  class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-all"
                  required>
              <option value="online">在线</option>
              <option value="idle">空闲</option>
              <option value="offline">离线</option>
            </select>
          </div>
        </form>
      </div>
      <div class="p-5 border-t border-gray-100 flex justify-end space-x-3">
        <button id="cancelAddBtn" class="px-4 py-2 border border-gray-300 text-gray-700 rounded-lg text-sm hover:bg-gray-50 transition-colors">
          取消
        </button>
        <button id="confirmAddBtn" class="px-4 py-2 bg-primary text-white rounded-lg text-sm hover:bg-primary/90 transition-colors">
          确认添加
        </button>
      </div>
    </div>
  </div>
  <!-- 移动端侧边栏遮罩 -->
  <div id="sidebar-overlay" class="fixed inset-0 bg-black bg-opacity-50 z-20 hidden md:hidden"></div>
  <!-- 引入拆分的JS文件 -->
  <script src="{{ url_for('static', filename='js/main.js') }}"></script>
  <script src="{{ url_for('static', filename='js/elevator.js') }}"></script>
  <script src="{{ url_for('static', filename='js/ota.js') }}"></script>
  <script src="{{ url_for('static', filename='js/robot.js') }}"></script>
  <script src="{{ url_for('static', filename='js/scripts.js') }}"></script>
</body>
</html>